package com.example.jd.finance.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import com.example.jd.common.enums.DeviceTypeEnum;
import com.example.jd.common.enums.NumberEnum;
import com.example.jd.common.enums.StatusEnum;
import com.example.jd.common.enums.TargetTypeEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.io.Serializable;

/**
 * <p>
 * 
 * </p>
 *
 * @author admin
 * @since 2021-11-06
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class MsWechatIncreaseFriends extends Model<MsWechatIncreaseFriends> {

    private static final long serialVersionUID=1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    private Long bid;

    /**
     * 企业微信号
     */
    private String enterpriseWechatCode;

    /**
     * 当前设备
     */
    private String currentDevice;

    /**
     * 1-空闲，2-忙碌，3，已下线
     */
    private Integer state;

    /**
     * 当日已增加好友数量
     */
    private Integer increaseFriendsTotalDay;

    /**
     * 累计已增加好友数量
     */
    private Integer cumulativeIncreaseFriends;

    /**
     * -1-删除，0-正常
     */
    private Integer status;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;

    /**
     * 修改时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateTime;


    public static MsWechatIncreaseFriends generateMsWechatIncreaseFriends(Long bid,String enterpriseWechatCode,String currentDevice,int isIncreaseFriends){
        return MsWechatIncreaseFriends.builder()
                .bid(bid)
                .enterpriseWechatCode(enterpriseWechatCode)
                .currentDevice(currentDevice)
                .state(DeviceTypeEnum.FREE.getType())
                .increaseFriendsTotalDay(NumberEnum.ZERO.getCode())
                .cumulativeIncreaseFriends(isIncreaseFriends)
                .status(StatusEnum.NORMAL.getCode())
                .createTime(LocalDateTime.now())
                .updateTime(LocalDateTime.now())
                .build();
    }

}
